<template>
	<view v-show="flag" class="container">
		<u-navbar :is-back="false" title="" :background="background">
			<view class="slot-wrap">我的</view>
<!-- 			<view class="slot-right" @click="toSysAnnoucement">
				<u-icon name="bell-fill" size="40rpx"></u-icon>
			</view> -->
		</u-navbar>
		<view>
			<!--
			    author: 李文昊
			    myUserInfo: 头像电话姓名一栏
			-->
			<my-user-info :name="userInfo.name" :phoneNumber="userInfo.phone" :headThumb="userInfo.headThumb"></my-user-info>
			<!--
			    author: 李文昊
			    hrs1:用来调节外边距
			-->
			<view class="hrs1"></view>
			<!--
			    author: 李文昊
			    description: 个人资料
			-->
			<my-item-check :my2List="personalDataList"></my-item-check>
			<!--
			    author: 李文昊
			    description: 费用
			-->
			<my-item-check :my2List="costList"></my-item-check>
			<!--
			    author: 李文昊
			    description: 合同
			-->
			<my-item-check :my2List="contractList"></my-item-check>
			<!--
			    author: 李文昊
			    description: 收楼
			-->
			<my-item-check :my2List="repossessionList"></my-item-check>
			<!--
			    author: 李文昊
			    description: 消防安全责任书
			-->
			<my-item-check :my2List="fireSafetyList"></my-item-check>
			<!--
			    author: 李文昊
			    description: 交房
			-->
			<my-item-check :my2List="giveHouseList"></my-item-check>
			<!--
			    author: 李文昊
			    description: 续租
			-->
			<my-item-check :my2List="releaseList"></my-item-check>
			<!--
			    author: 李文昊
			    description: 关于我们
			-->
			<my-item-check :my2List="aboutUsList"></my-item-check>
			<!--
			    author: 李文昊
			    description: 调节外边距
			-->
			<view class="hrs2"></view>
			<!--
			    author: 李文昊
			    description: 紧急联系号码
			-->
			<!-- <my-item-check :my2List="emergencyContactNumberList"></my-item-check> -->
			<!--
			    author: 李文昊
			    description: 发票
			-->
			<!-- <my-item-check :my2List="invoiceList"></my-item-check> -->
			<!--
			    author: 李文昊
			    description: 关于我们
			-->
<!-- 			<my-item-check :my2List="aboutUsList"></my-item-check> -->
			<!--
			    author: 李文昊
			    description: 支付账户绑定
			-->
			<!-- <my-item-check :my2List="paymentAccountBindingList"></my-item-check> -->
			<!--
			    author: 李文昊
			    description: 退出登录按钮，点击会从下方弹出浮框
			-->
			<view class="button-view">
				<button class="my-button" @click="logOut">退出登录</button>
			</view>
		</view>
		<!-- <u-tabbar v-model="current" :list="list" :before-switch="clickTabbar"></u-tabbar> -->
	</view>
</template>

<script>
	import {
		syncGetOrderList,
	} from "../../util/network.js"
	export default {
		data() {
			return {
				userInfo:"",
				personalDataList: {
					image: require("@/static/personalDataFiles.png"),
					text: "个人资料",
					url: '/pages/personalMsg/personalMsg',
					pendingNum:0,
				},
				costList: {
					image: require("@/static/cost.png"),
					text: "费用",
					url: '/pages/onlinePay/history/history',
					pendingNum:this.$pendingObj.pendingObj.onlinePay,
				},
				contractList: {
					image: require("@/static/contract.png"),
					text: "合同",
					url: '/pages/contractManage/list/list',
					pendingNum:0,
				},
				repossessionList: {
					image: require("@/static/receiveHouse.png"),
					text: "收楼",
					url: '/pages/receiveHouse/history/history',
					pendingNum:this.$pendingObj.pendingObj.deliverHouse,
				},
				fireSafetyList: {
					image: require("@/static/smartFireSafety.png"),
					text: "消防安全责任书",
					url: '/pages/contractManage/safeDetails/safeDetails',
					pendingNum:0,
				},
				giveHouseList: {
					image: require("@/static/repossession.png"),
					text: "退换租",
					url: '/pages/exchangeRent/history/history',
					pendingNum:this.$pendingObj.pendingObj.exchangeRent,
				},
				releaseList: {
					image: require("@/static/renewHouse.png"),
					text: "续租",
					url: '/pages/renewHouse/history/history',
					pendingNum:this.$pendingObj.pendingObj.renewal,
				},
				emergencyContactNumberList: {
					image: require("@/static/emergencyContact.png"),
					text: "紧急联系号码",
					url: '/pages/ECIPage/ECIPage',
					pendingNum:0,
				},
				invoiceList: {
					image: require("@/static/invoice.png"),
					text: "发票",
					pendingNum:0,
				},
				aboutUsList: {
					image: require("@/static/aboutUs.png"),
					text: "关于我们",
					url: '/pages/aboutUs/aboutUs',
					pendingNum:0,
				},
				paymentAccountBindingList: {
					image: require("@/static/alipay.png"),
					text: "支付账户绑定",
					pendingNum:0,
				},
				current: 0,
				background : {
					backgroundColor : '#FFFFFF'
				},
				flag:false,
			};
		},
		methods: {
			logOut() {
				uni.showActionSheet({
					itemList: ['退出登录'],
					success: function(res) {
						uni.removeStorage({
						    key: 'userinfo',
						    success: function (res) {
						        console.log('success');
						    }
						});
						uni.removeStorage({
						    key: 'token',
						    success: function (res) {
						        console.log('success');
						    }
						});
						uni.switchTab({
							url:'../home/home'
						})
					},
					fail: function(res) {
						console.log(res.errMsg);
					}
				})
			},
			toSysAnnoucement(){
				uni.navigateTo({
					url:'/pages/systemAnnoucement/list/list'
				})
			}
		},
		onShow: async function() {
			this.flag = false
			await syncGetOrderList("goods-release/list", [0], 0, 8).then(res => {
					 if(res.data.code == 200){
						this.userInfo = uni.getStorageSync('userinfo')
						this.flag = true
						this.costList = {
							image: require("@/static/cost.png"),
							text: "费用",
							url: '/pages/onlinePay/history/history',
							pendingNum:this.$pendingObj.pendingObj.onlinePay,
						}
						this.repossessionList = {
							image: require("@/static/receiveHouse.png"),
							text: "收楼",
							url: '/pages/receiveHouse/history/history',
							pendingNum:this.$pendingObj.pendingObj.deliverHouse,
						}
						this.giveHouseList = {
							image: require("@/static/repossession.png"),
							text: "退换租",
							url: '/pages/exchangeRent/history/history',
							pendingNum:this.$pendingObj.pendingObj.exchangeRent,
						}
						this.releaseList = {
							image: require("@/static/renewHouse.png"),
							text: "续租",
							url: '/pages/renewHouse/history/history',
							pendingNum:this.$pendingObj.pendingObj.renewal,
						}
					}else {
						uni.reLaunch({
							url:'/pages/login/login'
						})
					}
			})

		},
		onLoad: async function() {
			this.userInfo = uni.getStorageSync('userinfo')
			console.log('ceshi',this.userInfo)
		},
	}
</script>

<style>
	.container {
		background-color: rgba(245, 245, 245, 1);
		padding-bottom: 80rpx;
	}

	.hrs1 {
		margin-top: 40rpx;
	}

	.hrs2 {
		margin-top: 20rpx;
	}

	.button-view {
		margin-top: 70rpx;
	}

	.my-button {
		width: 600rpx;
		height: 80rpx;
		line-height: 80rpx;
		background-color: rgba(0, 121, 254, 1);
		color: #FFFFFF;
		font-size: 30rpx;
	}
	.slot-wrap {
		display: flex;
		align-items: center;
		padding-left: 40rpx;
		font-size: 35rpx;
		font-weight: 700;
	}
	.slot-right{
		display: flex;
		align-items: flex-end;
		padding-left: 570rpx;
		font-size: 30rpx;
		color:#007AFF;
	}
</style>
